<?php

    include '../../Include/IncludeSecure.php';

    $plantillaP = new Panel( "../View/Html/Plantilla.html" );
    $plantillaEC = new Panel( "../View/Html/Encabezado.html" );
    $plantillaEC->add( "TITULO" , "Gestion de Proveedores" );
    $plantillaEC->add( $_SESSION );

    if ( $_SESSION['USR_PRIVILEGIO'] == 'ADMIN' ){
        $plantillaPrivilegio = new Panel( "../View/Html/MenuPrivilegio.html" );
        $plantillaEC->add( "MENU_PRIVILEGIO" , $plantillaPrivilegio );
    }

    $plantillaP->add( "ENCABEZADO" , $plantillaEC );
    $plantillaCON = new Panel( "../View/Html/GestionProveedor.html" );

    $hBlock = $plantillaCON->setBlock( "BLQ_PRV_INFO" );

    try {
        $proveedorLogica = FabricaComando::crearListaProveedor();
        $listaProveedor = $proveedorLogica->hacer();
    } catch ( ProveedorLogicaException $Ex ) {
        new ExceptionHandler( $Ex );
    }

    if ( $listaProveedor != false ){
        foreach ( $listaProveedor as $proveedor ){

            $plantillaCON->add( $proveedor->toArray() );
            $plantillaCON->concat($hBlock);

        }
    }

    $plantillaP->add( "CONTENIDO" , $plantillaCON );
    $plantillaPIE = new Panel( "../View/Html/Pie.html" );
    $plantillaP->add( "PIE" , $plantillaPIE );
    $plantillaP->show();

?>